﻿import QtQuick 2.0
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import ConfigElementType 1.0
import "qrc:/qmlComponents/ConfigManager"
import "qrc:/qmlComponents/AxisModulePos"
import "qrc:/qmlComponents/VisionViewer"
import "qrc:/qmlComponents/CustomizedUIElement/RowColumnSelectorView"

Item{
    ColumnLayout {
        spacing: 30
        RowLayout{
            RowColumnSelector{
                rowColInfo: stRowColInfo
            }
            Button{
                text: qsTr("MoveToSensorPrPos")
                onClicked: {
                    tem.runSingleCmd(pickArm, "moveToSensorPrPos",
                                     [stRowColInfo.unitRow, stRowColInfo.unitColumn, stRowColInfo.row, stRowColInfo.column])
                    }
            }
        }

        RowLayout{
            SAxisModulePos{
                moduleName: "PickerZ1"
                posName: "LoadMaterialPos"
            }
            ColumnLayout{
                ConfigRow{
                    configModel: paConfig
                    configName: "pickSensorOffsetX"
                    Component.onCompleted: {
                        autoInit()
                    }
                }

                ConfigRow{
                    configModel: paConfig
                    configName: "pickSensorOffsetY"
                    Component.onCompleted: {
                        autoInit()
                    }
                }
            }


            ColumnLayout{
                Button{
                    text: qsTr("Pick_Sensor")
                    onClicked: {
                        tem.runSingleCmd(pickArm, "moveToPickSensor",
                                         [stRowColInfo.unitRow, stRowColInfo.unitColumn, stRowColInfo.row, stRowColInfo.column])
                    }
                }
                Button{
                    text: qsTr("PlaceSensorBackToTray")
                    onClicked: {
                        tem.runSingleCmd(pickArm, "placeBackMaterial", [true])
                        }
                }
            }

        }

        XYZModulePos{
            moduleName: "SUTXYZ"
            posName: "LoadSensorPos"
        }

        RowLayout{

            SAxisModulePos{
                moduleName: "PickArmY"
                posName: "PlaceSensorPos"
            }

            SAxisModulePos{
                moduleName: "PickerZ1"
                posName: "PlaceSenserStandbyPos"
            }

            SAxisModulePos
            {
                moduleName: "PickerZ1"
                posName: "PlaceSensorPos"
            }

            Button{
                text: qsTr("Place_Sensor")
                onClicked: {
                    tem.runSingleCmd(pickArm, "moveToPlaceSensorToSut");
                }
            }
        }

    }
}
